package com.fitso.model.dao;

import java.util.List;

import com.fitso.model.bean.nutrition.Food;

/**
 * Dao for working with {@link Food} persistence store
 * 
 * @author timothystorm
 */
public interface FoodDao {
	/**
	 * Fetch all {@link Food}s from the persistence store. Be cautious this may
	 * return a huge list
	 * 
	 * @return all foods from the persistence store
	 */
	List<Food> read();

	/**
	 * Fetches a sing {@link Food} by id or null if not food in the store has
	 * the given id
	 * 
	 * @param id
	 * @return
	 */
	Food readById(Long id);

	/**
	 * Fetches all {@link Food}s with the provided ids. Non matches won't return
	 * anything. If there are no matches withing the list of ids, imlementations
	 * should still return back an empty list.
	 * 
	 * @param ids
	 * @return
	 */
	List<Food> readById(List<Long> ids);

	/**
	 * Save a single {@link Food} to the persistence store
	 * 
	 * @param food
	 */
	void createOrUpdate(Food food);

	/**
	 * Saves a list of {@link Food}s to the persistence store
	 * 
	 * @param foods
	 */
	void createOrUpdate(List<Food> foods);

	/**
	 * Deletes a single {@link Food} from the persistence store. If a food is
	 * not currently persisted, implementations should throw some kind of
	 * meaningful runtime exception.
	 * 
	 * @param food
	 */
	void delete(Food food);

	/**
	 * Deletes multiple {@link Food}s from the persistence store. Any food items
	 * in the list cannot be deleted because they are not currently persisted
	 * then the remaining food items in the list should be removed successfully
	 * without error.
	 * 
	 * @param foods
	 */
	void delete(List<Food> foods);
}
